import { Prop, Schema, SchemaFactory, raw } from '@nestjs/mongoose'
import { HydratedDocument } from 'mongoose'

export type WorkflowDataDocument = HydratedDocument<WorkflowData>

@Schema()
export class WorkflowData {
  @Prop()
  public name: string

  @Prop(raw({ username: String, nickname: String }))
  public submitter: Record<string, any>

  @Prop({ type: Object })
  public formData: Record<string, any>

  @Prop({ type: Object })
  public flowData: any[]

  @Prop()
  public status: '未处理' | '** 处理中' | '通过' | '否决' | string
}

export const WorkflowDataSchema = SchemaFactory.createForClass(WorkflowData)
